home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / IDCRKME60.C < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-13  |  6.0 KB  |  194 lines

  1. /*@@ Wedit generated application. Written Sun Jun 13 11:59:27 1999
  2.  @@header: d:\crackmes\idcrkme60\idcrkme60res.h
  3.  @@resources: d:\crackmes\idcrkme60\idcrkme60.rc
  4.  Do not edit outside the indicated areas */
  5. /*<---------------------------------------------------------------------->*/
  6. /*<---------------------------------------------------------------------->*/
  7. #include <windows.h>
  8. #include <windowsx.h>
  9. #include <commctrl.h>
  10. #include <string.h>
  11. #include "d:\crackmes\idcrkme60\idcrkme60res.h"
  12. #include "d:\crackmes\idcrkme60\ezfont.h"
  13. /* --- The following code comes from C:\lcc\lib\wizard\dlgbased.tpl. */
  14. /*<---------------------------------------------------------------------->*/
  15.  
  16. /*
  17. Template for a dialog based application. The main procedure for this
  18. template is the DialogFunc below. Modify it to suit your needs.
  19. */
  20. /* prototype for the dialog box function. */
  21. static BOOL CALLBACK DialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  22. static BOOL CALLBACK AboutProc (HWND hwndDialog, UINT msg, WPARAM wParam, LPARAM lParam);
  23. static BOOL CALLBACK RequestProc (HWND hwndDialog, UINT msg, WPARAM wParam, LPARAM lParam);
  24. /*
  25. Win main just registers a class of the same type that the dialog class, and
  26. then calls DialogBox. Then it exits. The return value is the return value of
  27. the dialog procedure.
  28. */
  29.  
  30. int APIENTRY WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, int nCmdShow)
  31. {
  32.     WNDCLASS wc;
  33.  
  34.     memset(&wc,0,sizeof(wc));
  35.     wc.lpfnWndProc = DefDlgProc;
  36.     wc.cbWndExtra = DLGWINDOWEXTRA;
  37.     wc.hInstance = hinst;
  38.     wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(MAINICON));
  39.     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  40.     wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
  41.     wc.lpszClassName = "idcrkme60";
  42.     RegisterClass(&wc);
  43.  
  44.     return DialogBox(hinst, MAKEINTRESOURCE(IDD_MAINDIALOG), NULL, (DLGPROC) DialogFunc);
  45.  
  46. }
  47.  
  48. /*
  49. You should add your initialization code here. This function will be called
  50. when the dialog box receives the WM_INITDIALOG message.
  51. */
  52. static int InitializeApp(HWND hDlg,WPARAM wParam, LPARAM lParam)
  53. {
  54.     return 1;
  55. }
  56.  
  57. /*
  58. This is the main function for the dialog. It handles all messages. Do what your
  59. application needs to do here.
  60. */
  61. static BOOL CALLBACK DialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  62. {
  63.     HINSTANCE hinst;
  64.     BOOL      FullVersion = FALSE;
  65.  
  66.     switch (msg) {
  67.     /* This message means the dialog is started but not yet visible.
  68.        Do All initializations here
  69.         */
  70.     case WM_INITDIALOG:
  71.         if (!FullVersion) EnableWindow(GetDlgItem(hwndDlg, IDREQUEST), FALSE);
  72.         InitializeApp(hwndDlg,wParam,lParam);
  73.         return TRUE;
  74.     /* By default, IDOK means close this dialog returning 1, IDCANCEL means
  75.            close this dialog returning zero
  76.         */
  77.     case WM_COMMAND:
  78.         switch (LOWORD(wParam)) {
  79.             case IDOK:
  80.                 EndDialog(hwndDlg,1);
  81.                 return 1;
  82.             case IDCANCEL:
  83.                 EndDialog(hwndDlg,0);
  84.                 return 1;
  85.             case IDABOUT:
  86.                 DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTDIALOG), hwndDlg, (DLGPROC) AboutProc);
  87.                 return 1;
  88.             case IDREQUEST:
  89.                 if (!FullVersion) {EnableWindow(GetDlgItem(hwndDlg, IDREQUEST), FALSE); return -1;}
  90.                 DialogBox(hinst, MAKEINTRESOURCE(IDD_REQUESTDIALOG), hwndDlg, (DLGPROC) RequestProc);
  91.         }
  92.         break;
  93.         /* By default, WM_CLOSE is equivalent to CANCEL */
  94.     case WM_CLOSE:
  95.         EndDialog(hwndDlg,0);
  96.         return TRUE;
  97.  
  98.     }
  99.     return FALSE;
  100. }
  101.  
  102. static BOOL    CALLBACK AboutProc    (HWND hwndDialog, UINT msg, WPARAM wParam, LPARAM lParam)
  103. {
  104.  
  105.     static    HWND hName;
  106.     static    HWND hAboutText;
  107.     static    HFONT hFontName;
  108.     static    HDC hDCName;
  109.     static char szAboutText[] = "If you need help on cracking this CrackMe, visit "
  110.                                 "http://disc.server.com/discussion.cgi?id=42877\r\n"
  111.                                 "\r\n"
  112.                                 "Please post the questions there and don't mail me, since I won't answer any E-Mailed question regarding this CrackMe!\r\n"
  113.                                 "\r\n"
  114.                                 "\r\n"
  115.                                 "Special thanks:\r\n"
  116.                                 "MiZ [RefleXZ]\r\n"
  117.                                                                 "LUCIFER48\r\n"
  118.                                 "\r\n"
  119.                                 "\r\n"
  120.                                 "Thanks and greetings (no particular order):\r\n"
  121.                                                                 "+MaLaTTiA, alpine, Borna, Crackz, DnNuke, epxy, Eternal Bliss, Fravia, gAnZ, HarvestR, Iczelion, Jeff, LaZaRuS, Lord Soth, LUCIFER48, McCodEMaN, MiZ, OkStart, NiKai, pruri, Rhayader, Santa Clawz, tC, The Sandman, Vladimir, Volatility, WKT Group, Xomgromit\r\n"
  122.                                 "\r\n"                                "\r\n"
  123.                         "    \"There's always one way to crack a target - just think a bit!\""
  124.                         "\r\n"
  125.                         "                      TORN@DO\r\n"
  126.                                 " \0 ";
  127.  
  128.     switch (msg)
  129.     {
  130.  
  131.     case WM_INITDIALOG:
  132.         hAboutText = GetDlgItem(hwndDialog, 1008);
  133.         hName = GetDlgItem(hwndDialog, 1007);
  134.         hDCName = GetDC(hName);
  135.         hFontName = EzCreateFont (hDCName, "Impact", 240, 0, EZ_ATTR_BOLD, TRUE);
  136.         SelectObject (hDCName, hFontName);
  137.         SendMessage(hName, WM_SETFONT, (WPARAM) hFontName, MAKELPARAM(TRUE, 0));
  138.  
  139.         SetWindowText(hAboutText, szAboutText);
  140.  
  141.         return FALSE ;
  142.  
  143.     case WM_COMMAND :
  144.         switch (LOWORD (wParam))
  145.         {
  146.         case IDOK :
  147.         case IDCANCEL :
  148.             EndDialog(hwndDialog,0);
  149.             break;
  150.         }
  151.  
  152.         case WM_DESTROY:
  153.             DeleteObject(hFontName);
  154.             return FALSE ;
  155.  
  156.     }
  157.     return FALSE ;
  158. }
  159.  
  160.  
  161. static BOOL    CALLBACK RequestProc    (HWND hwndDialog, UINT msg, WPARAM wParam, LPARAM lParam)
  162. {
  163.     static    HWND hName;
  164.     static    HFONT hFontName;
  165.     static    HDC hDCName;
  166.  
  167.     switch (msg)
  168.     {
  169.  
  170.     case WM_INITDIALOG:
  171.         hName = GetDlgItem(hwndDialog, 1013);
  172.         hDCName = GetDC(hName);
  173.         hFontName = EzCreateFont(hDCName, "MS Sans Serif", 12, 0, EZ_ATTR_BOLD, TRUE);
  174.         SelectObject (hDCName, hFontName);
  175.         SendMessage(hName, WM_SETFONT, (WPARAM) hFontName, MAKELPARAM(TRUE, 0));
  176.  
  177.         return FALSE ;
  178.  
  179.     case WM_COMMAND :
  180.         switch (LOWORD (wParam))
  181.         {
  182.         case IDOK :
  183.         case IDCANCEL :
  184.             EndDialog(hwndDialog,0);
  185.             break;
  186.         }
  187.  
  188.         case WM_DESTROY:
  189.             return FALSE ;
  190.      }
  191.  
  192.     return FALSE ;
  193. }
  194.